<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function fn() {
            var w = screen.width;
            var h = screen.height;
            alert("屏幕分辨率为："+w+','+h);
        }
        function fn1() {
            var w1 = screen.availWidth;
            var h1 = screen.availHeight;
            alert("屏幕分辨率为："+w1+','+h1);
        }
    </script>
</head>
<body>
<input type="button" value="点击获取屏幕分辨率" onclick="fn()">
<input type="button" value="点击获取除去任务栏之后的分辨率" onclick="fn1()">
</body>
</html>